package com.business.system.service.impl;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.business.system.dao.TabRepairFlowMapper;
import com.business.system.pojo.TabRepairFlow;
import com.business.system.pojo.TabRepairFlowExample;
import com.business.system.service.ITabRapairFlowService;

@Service
public class TabRepairFlowSerivceImpl implements ITabRapairFlowService {

	@Autowired
	private TabRepairFlowMapper repairFlowMapper;

	@Override
	public List<TabRepairFlow> findPreStep(TabRepairFlow entity, String flag)
			throws RuntimeException {
		// TODO Auto-generated method stub
		if (flag != null && !"".equals(flag) && entity.getId() != null
				&& !"".equals(entity.getId())) {
			List<TabRepairFlow> list;
			/**
			 * <code>
			 * 估价派工环节，查询已经进行车辆登记的委托单号
			 */
			if ("3".equals(flag)) {
				TabRepairFlowExample example = new TabRepairFlowExample();
				example.createCriteria().andIdEqualTo(entity.getId());
				example.createCriteria().andFlowStepEqualTo("2");
				list = this.repairFlowMapper.selectByExampleJoin(example);

				return list;
			}
			return null;
		} else {
			return new ArrayList<TabRepairFlow>();
		}
	}
}
